﻿@inherits AntDesignTestBase	
@code {

	[Fact]
	public void TextArea_ShowCount_shows_initial_value()
	{
		//Arrange
		string value = "0123456789";
		var cut = Render(@<AntDesign.TextArea ShowCount MaxLength=100 Value=@value/>);
		//Act
		var divWrapper = cut.Find("div");
		var attribute = divWrapper.GetAttribute("data-count");
		//Assert           
		attribute.Should().Be(value.Length.ToString());		
	}

	[Fact]
	public async Task TextArea_ShowCount_increase()
	{
		//Arrange	
		string value = "";
		string newValue = "newValue";
		var cut = Render<AntDesign.TextArea>(@<AntDesign.TextArea ShowCount MaxLength=100 Value=@value DebounceMilliseconds="0"/>);
		//Act
		cut.Find("textarea").Input(newValue);
		cut.Find("textarea").KeyUp(String.Empty);
		var divWrapper = cut.Find("div");
		var attribute = divWrapper.GetAttribute("data-count");
		//Assert				
		attribute.Should().Be(newValue.Length.ToString());
	} 

	[Fact]
	public void TextArea_ReadOnly_creates_attribute()
	{
		//Arrange
		var cut = Render<AntDesign.TextArea>(@<AntDesign.TextArea ReadOnly Value="@("0123456789")"/>);
		//Act
		var textAreaElement = cut.Find("textarea");
		//Assert           
		textAreaElement.HasAttribute("readonly");
	}
}